﻿/**
 * jQuery EasyUI 1.3.3
 *
 * Copyright (c) 2009-2013 www.jeasyui.com. All rights reserved.
 *
 * Licensed under the GPL or commercial licenses
 * To use it on other terms please contact us: info@jeasyui.com
 * http://www.gnu.org/licenses/gpl.txt
 * http://www.jeasyui.com/license_commercial.php
 *
 */
(function ($) {
    var _1 = 0;

    function _2(a, o) {
        for (var i = 0, _3 = a.length; i < _3; i++) {
            if (a[i] == o) {
                return i;
            }
        }
        return -1;
    };
    function _4(a, o, id) {
        if (typeof o == "string") {
            for (var i = 0, _5 = a.length; i < _5; i++) {
                if (a[i][o] == id) {
                    a.splice(i, 1);
                    return;
                }
            }
        } else {
            var _6 = _2(a, o);
            if (_6 != -1) {
                a.splice(_6, 1);
            }
        }
    };
    function _7(a, o, r) {
        for (var i = 0, _8 = a.length; i < _8; i++) {
            if (a[i][o] == r[o]) {
                return;
            }
        }
        a.push(r);
    };
    function _9(_a) {
        var cc = _a || $("head");
        var _b = $.data(cc[0], "ss");
        if (!_b) {
            _b = $.data(cc[0], "ss", {cache: {}, dirty: []});
        }
        return {
            add: function (_c) {
                var ss = ["<style type=\"text/css\">"];
                for (var i = 0; i < _c.length; i++) {
                    _b.cache[_c[i][0]] = {width: _c[i][1]};
                }
                var _d = 0;
                for (var s in _b.cache) {
                    var _e = _b.cache[s];
                    _e.index = _d++;
                    ss.push(s + "{width:" + _e.width + "}");
                }
                ss.push("</style>");
                $(ss.join("\n")).appendTo(cc);
                setTimeout(function () {
                    cc.children("style:not(:last)").remove();
                }, 0);
            }, getRule: function (_f) {
                var _10 = cc.children("style:last")[0];
                var _11 = _10.styleSheet ? _10.styleSheet : (_10.sheet || document.styleSheets[document.styleSheets.length - 1]);
                var _12 = _11.cssRules || _11.rules;
                return _12[_f];
            }, set: function (_13, _14) {
                var _15 = _b.cache[_13];
                if (_15) {
                    _15.width = _14;
                    var _16 = this.getRule(_15.index);
                    if (_16) {
                        _16.style["width"] = _14;
                    }
                }
            }, remove: function (_17) {
                var tmp = [];
                for (var s in _b.cache) {
                    if (s.indexOf(_17) == -1) {
                        tmp.push([s, _b.cache[s].width]);
                    }
                }
                _b.cache = {};
                this.add(tmp);
            }, dirty: function (_18) {
                if (_18) {
                    _b.dirty.push(_18);
                }
            }, clean: function () {
                for (var i = 0; i < _b.dirty.length; i++) {
                    this.remove(_b.dirty[i]);
                }
                _b.dirty = [];
            }
        };
    };
    function _19(_1a, _1b) {
        var _1c = $.data(_1a, "datagrid").options;
        var _1d = $.data(_1a, "datagrid").panel;
        if (_1b) {
            if (_1b.width) {
                _1c.width = _1b.width;
            }
            if (_1b.height) {
                _1c.height = _1b.height;
            }
        }
        if (_1c.fit == true) {
            var p = _1d.panel("panel").parent();
            _1c.width = p.width();
            _1c.height = p.height();
        }
        _1d.panel("resize", {width: _1c.width, height: _1c.height});
    };
    function _1e(_1f) {
        var _20 = $.data(_1f, "datagrid").options;
        var dc = $.data(_1f, "datagrid").dc;
        var _21 = $.data(_1f, "datagrid").panel;
        var _22 = _21.width();
        var _23 = _21.height();
        var _24 = dc.view;
        var _25 = dc.view1;
        var _26 = dc.view2;
        var _27 = _25.children("div.datagrid-header");
        var _28 = _26.children("div.datagrid-header");
        var _29 = _27.find("table");
        var _2a = _28.find("table");
        _24.width(_22);
        var _2b = _27.children("div.datagrid-header-inner").show();
        _25.width(_2b.find("table").width());
        if (!_20.showHeader) {
            _2b.hide();
        }
        _26.width(_22 - _25._outerWidth());
        _25.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_25.width());
        _26.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer").width(_26.width());
        var hh;
        _27.css("height", "");
        _28.css("height", "");
        _29.css("height", "");
        _2a.css("height", "");
        hh = Math.max(_29.height(), _2a.height());
        _29.height(hh);
        _2a.height(hh);
        _27.add(_28)._outerHeight(hh);
        if (_20.height != "auto") {
            var _2c = _23 - _26.children("div.datagrid-header")._outerHeight() - _26.children("div.datagrid-footer")._outerHeight() - _21.children("div.datagrid-toolbar")._outerHeight();
            _21.children("div.datagrid-pager").each(function () {
                _2c -= $(this)._outerHeight();
            });
            dc.body1.add(dc.body2).children("table.datagrid-btable-frozen").css({
                position: "absolute",
                top: dc.header2._outerHeight()
            });
            var _2d = dc.body2.children("table.datagrid-btable-frozen")._outerHeight();
            _25.add(_26).children("div.datagrid-body").css({marginTop: _2d, height: (_2c - _2d)});
        }
        _24.height(_26.height());
    };
    function _2e(_2f, _30, _31) {
        var _32 = $.data(_2f, "datagrid").data.rows;
        var _33 = $.data(_2f, "datagrid").options;
        var dc = $.data(_2f, "datagrid").dc;
        if (!dc.body1.is(":empty") && (!_33.nowrap || _33.autoRowHeight || _31)) {
            if (_30 != undefined) {
                var tr1 = _33.finder.getTr(_2f, _30, "body", 1);
                var tr2 = _33.finder.getTr(_2f, _30, "body", 2);
                _34(tr1, tr2);
            } else {
                var tr1 = _33.finder.getTr(_2f, 0, "allbody", 1);
                var tr2 = _33.finder.getTr(_2f, 0, "allbody", 2);
                _34(tr1, tr2);
                if (_33.showFooter) {
                    var tr1 = _33.finder.getTr(_2f, 0, "allfooter", 1);
                    var tr2 = _33.finder.getTr(_2f, 0, "allfooter", 2);
                    _34(tr1, tr2);
                }
            }
        }
        _1e(_2f);
        if (_33.height == "auto") {
            var _35 = dc.body1.parent();
            var _36 = dc.body2;
            var _37 = _38(_36);
            var _39 = _37.height;
            if (_37.width > _36.width()) {
                _39 += 18;
            }
            _35.height(_39);
            _36.height(_39);
            dc.view.height(dc.view2.height());
        }
        dc.body2.triggerHandler("scroll");
        function _34(_3a, _3b) {
            for (var i = 0; i < _3b.length; i++) {
                var tr1 = $(_3a[i]);
                var tr2 = $(_3b[i]);
                tr1.css("height", "");
                tr2.css("height", "");
                var _3c = Math.max(tr1.height(), tr2.height());
                tr1.css("height", _3c);
                tr2.css("height", _3c);
            }
        };
        function _38(cc) {
            var _3d = 0;
            var _3e = 0;
            $(cc).children().each(function () {
                var c = $(this);
                if (c.is(":visible")) {
                    _3e += c._outerHeight();
                    if (_3d < c._outerWidth()) {
                        _3d = c._outerWidth();
                    }
                }
            });
            return {width: _3d, height: _3e};
        };
    };
    function _3f(_40, _41) {
        var _42 = $.data(_40, "datagrid");
        var _43 = _42.options;
        var dc = _42.dc;
        if (!dc.body2.children("table.datagrid-btable-frozen").length) {
            dc.body1.add(dc.body2).prepend("<table class=\"datagrid-btable datagrid-btable-frozen\" cellspacing=\"0\" cellpadding=\"0\"></table>");
        }
        _44(true);
        _44(false);
        _1e(_40);
        function _44(_45) {
            var _46 = _45 ? 1 : 2;
            var tr = _43.finder.getTr(_40, _41, "body", _46);
            (_45 ? dc.body1 : dc.body2).children("table.datagrid-btable-frozen").append(tr);
        };
    };
    function _47(_48, _49) {
        function _4a() {
            var _4b = [];
            var _4c = [];
            $(_48).children("thead").each(function () {
                var opt = $.parser.parseOptions(this, [{frozen: "boolean"}]);
                $(this).find("tr").each(function () {
                    var _4d = [];
                    $(this).find("th").each(function () {
                        var th = $(this);
                        var col = $.extend({}, $.parser.parseOptions(this, ["field", "align", "halign", "order", {
                            sortable: "boolean",
                            checkbox: "boolean",
                            resizable: "boolean",
                            fixed: "boolean"
                        }, {rowspan: "number", colspan: "number", width: "number"}]), {
                            title: (th.html() || undefined),
                            hidden: (th.attr("hidden") ? true : undefined),
                            formatter: (th.attr("formatter") ? eval(th.attr("formatter")) : undefined),
                            styler: (th.attr("styler") ? eval(th.attr("styler")) : undefined),
                            sorter: (th.attr("sorter") ? eval(th.attr("sorter")) : undefined)
                        });
                        if (th.attr("editor")) {
                            var s = $.trim(th.attr("editor"));
                            if (s.substr(0, 1) == "{") {
                                col.editor = eval("(" + s + ")");
                            } else {
                                col.editor = s;
                            }
                        }
                        _4d.push(col);
                    });
                    opt.frozen ? _4b.push(_4d) : _4c.push(_4d);
                });
            });
            return [_4b, _4c];
        };
        var _4e = $("<div class=\"datagrid-wrap\">" + "<div class=\"datagrid-view\">" + "<div class=\"datagrid-view1\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\">" + "<div class=\"datagrid-body-inner\"></div>" + "</div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "<div class=\"datagrid-view2\">" + "<div class=\"datagrid-header\">" + "<div class=\"datagrid-header-inner\"></div>" + "</div>" + "<div class=\"datagrid-body\"></div>" + "<div class=\"datagrid-footer\">" + "<div class=\"datagrid-footer-inner\"></div>" + "</div>" + "</div>" + "</div>" + "</div>").insertAfter(_48);
        _4e.panel({doSize: false});
        _4e.panel("panel").addClass("datagrid").bind("_resize", function (e, _4f) {
            var _50 = $.data(_48, "datagrid").options;
            if (_50.fit == true || _4f) {
                _19(_48);
                setTimeout(function () {
                    if ($.data(_48, "datagrid")) {
                        _51(_48);
                    }
                }, 0);
            }
            return false;
        });
        $(_48).hide().appendTo(_4e.children("div.datagrid-view"));
        var cc = _4a();
        var _52 = _4e.children("div.datagrid-view");
        var _53 = _52.children("div.datagrid-view1");
        var _54 = _52.children("div.datagrid-view2");
        var _55 = _4e.closest("div.datagrid-view");
        if (!_55.length) {
            _55 = _52;
        }
        var ss = _9(_55);
        return {
            panel: _4e,
            frozenColumns: cc[0],
            columns: cc[1],
            dc: {
                view: _52,
                view1: _53,
                view2: _54,
                header1: _53.children("div.datagrid-header").children("div.datagrid-header-inner"),
                header2: _54.children("div.datagrid-header").children("div.datagrid-header-inner"),
                body1: _53.children("div.datagrid-body").children("div.datagrid-body-inner"),
                body2: _54.children("div.datagrid-body"),
                footer1: _53.children("div.datagrid-footer").children("div.datagrid-footer-inner"),
                footer2: _54.children("div.datagrid-footer").children("div.datagrid-footer-inner")
            },
            ss: ss
        };
    };
    function _56(_57) {
        var _58 = $.data(_57, "datagrid");
        var _59 = _58.options;
        var dc = _58.dc;
        var _5a = _58.panel;
        _5a.panel($.extend({}, _59, {
            id: null, doSize: false, onResize: function (_5b, _5c) {
                setTimeout(function () {
                    if ($.data(_57, "datagrid")) {
                        _1e(_57);
                        _87(_57);
                        _59.onResize.call(_5a, _5b, _5c);
                    }
                }, 0);
            }, onExpand: function () {
                _2e(_57);
                _59.onExpand.call(_5a);
            }
        }));
        _58.rowIdPrefix = "datagrid-row-r" + (++_1);
        _58.cellClassPrefix = "datagrid-cell-c" + _1;
        _5d(dc.header1, _59.frozenColumns, true);
        _5d(dc.header2, _59.columns, false);
        _5e();
        dc.header1.add(dc.header2).css("display", _59.showHeader ? "block" : "none");
        dc.footer1.add(dc.footer2).css("display", _59.showFooter ? "block" : "none");
        if (_59.toolbar) {
            if (typeof _59.toolbar == "string") {
                $(_59.toolbar).addClass("datagrid-toolbar").prependTo(_5a);
                $(_59.toolbar).show();
            } else {
                $("div.datagrid-toolbar", _5a).remove();
                var tb = $("<div class=\"datagrid-toolbar\"><table cellspacing=\"0\" cellpadding=\"0\"><tr></tr></table></div>").prependTo(_5a);
                var tr = tb.find("tr");
                for (var i = 0; i < _59.toolbar.length; i++) {
                    var btn = _59.toolbar[i];
                    if (btn == "-") {
                        $("<td><div class=\"datagrid-btn-separator\"></div></td>").appendTo(tr);
                    } else {
                        var td = $("<td></td>").appendTo(tr);
                        var _5f = $("<a href=\"javascript:void(0)\"></a>").appendTo(td);
                        _5f[0].onclick = eval(btn.handler || function () {
                            });
                        _5f.linkbutton($.extend({}, btn, {plain: true}));
                    }
                }
            }
        } else {
            $("div.datagrid-toolbar", _5a).remove();
        }
        $("div.datagrid-pager", _5a).remove();
        if (_59.pagination) {
            var _60 = $("<div class=\"datagrid-pager\"></div>");
            if (_59.pagePosition == "bottom") {
                _60.appendTo(_5a);
            } else {
                if (_59.pagePosition == "top") {
                    _60.addClass("datagrid-pager-top").prependTo(_5a);
                } else {
                    var _61 = $("<div class=\"datagrid-pager datagrid-pager-top\"></div>").prependTo(_5a);
                    _60.appendTo(_5a);
                    _60 = _60.add(_61);
                }
            }
            _60.pagination({
                total: 0,
                pageNumber: _59.pageNumber,
                pageSize: _59.pageSize,
                pageList: _59.pageList,
                onSelectPage: function (_62, _63) {
                    _59.pageNumber = _62;
                    _59.pageSize = _63;
                    _60.pagination("refresh", {pageNumber: _62, pageSize: _63});
                    _160(_57);
                }
            });
            _59.pageSize = _60.pagination("options").pageSize;
        }
        function _5d(_64, _65, _66) {
            if (!_65) {
                return;
            }
            $(_64).show();
            $(_64).empty();
            var t = $("<table class=\"datagrid-htable\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>").appendTo(_64);
            for (var i = 0; i < _65.length; i++) {
                var tr = $("<tr class=\"datagrid-header-row\"></tr>").appendTo($("tbody", t));
                var _67 = _65[i];
                for (var j = 0; j < _67.length; j++) {
                    var col = _67[j];
                    var _68 = "";
                    if (col.rowspan) {
                        _68 += "rowspan=\"" + col.rowspan + "\" ";
                    }
                    if (col.colspan) {
                        _68 += "colspan=\"" + col.colspan + "\" ";
                    }
                    var td = $("<td " + _68 + "></td>").appendTo(tr);
                    if (col.checkbox) {
                        td.attr("field", col.field);
                        $("<div class=\"datagrid-header-check\"></div>").html("<input type=\"checkbox\"/>").appendTo(td);
                    } else {
                        if (col.field) {
                            td.attr("field", col.field);
                            td.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"></span></div>");
                            $("span", td).html(col.title);
                            $("span.datagrid-sort-icon", td).html("&nbsp;");
                            var _69 = td.find("div.datagrid-cell");
                            if (_59.sortName == col.field) {
                                _69.addClass("datagrid-sort-" + _59.sortOrder);
                            }
                            if (col.resizable == false) {
                                _69.attr("resizable", "false");
                            }
                            if (col.width) {
                                _69._outerWidth(col.width);
                                col.boxWidth = parseInt(_69[0].style.width);
                            } else {
                                col.auto = true;
                            }
                            _69.css("text-align", (col.halign || col.align || ""));
                            col.cellClass = _58.cellClassPrefix + "-" + col.field.replace(/[\.|\s]/g, "-");
                        } else {
                            $("<div class=\"datagrid-cell-group\"></div>").html(col.title).appendTo(td);
                        }
                    }
                    if (col.hidden) {
                        td.hide();
                    }
                }
            }
            if (_66 && _59.rownumbers) {
                var td = $("<td rowspan=\"" + _59.frozenColumns.length + "\"><div class=\"datagrid-header-rownumber\"></div></td>");
                if ($("tr", t).length == 0) {
                    td.wrap("<tr class=\"datagrid-header-row\"></tr>").parent().appendTo($("tbody", t));
                } else {
                    td.prependTo($("tr:first", t));
                }
            }
        };
        function _5e() {
            var _6a = [];
            var _6b = _6c(_57, true).concat(_6c(_57));
            for (var i = 0; i < _6b.length; i++) {
                var col = _6d(_57, _6b[i]);
                if (col && !col.checkbox) {
                    _6a.push(["." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto"]);
                }
            }
            _58.ss.add(_6a);
            _58.ss.dirty(_58.cellSelectorPrefix);
            _58.cellSelectorPrefix = "." + _58.cellClassPrefix;
        };
    };
    function _6e(_6f) {
        var _70 = $.data(_6f, "datagrid");
        var _71 = _70.panel;
        var _72 = _70.options;
        var dc = _70.dc;
        var _73 = dc.header1.add(dc.header2);
        _73.find("input[type=checkbox]").unbind(".datagrid").bind("click.datagrid", function (e) {
            if (_72.singleSelect && _72.selectOnCheck) {
                return false;
            }
            if ($(this).is(":checked")) {
                _fb(_6f);
            } else {
                _101(_6f);
            }
            e.stopPropagation();
        });
        var _74 = _73.find("div.datagrid-cell");
        _74.closest("td").unbind(".datagrid").bind("mouseenter.datagrid", function () {
            if (_70.resizing) {
                return;
            }
            $(this).addClass("datagrid-header-over");
        }).bind("mouseleave.datagrid", function () {
            $(this).removeClass("datagrid-header-over");
        }).bind("contextmenu.datagrid", function (e) {
            var _75 = $(this).attr("field");
            _72.onHeaderContextMenu.call(_6f, e, _75);
        });
        _74.unbind(".datagrid").bind("click.datagrid", function (e) {
            var p1 = $(this).offset().left + 5;
            var p2 = $(this).offset().left + $(this)._outerWidth() - 5;
            if (e.pageX < p2 && e.pageX > p1) {
                var _76 = $(this).parent().attr("field");
                var col = _6d(_6f, _76);
                if (!col.sortable || _70.resizing) {
                    return;
                }
                _72.sortName = _76;
                _72.sortOrder = col.order || "asc";
                var cls = "datagrid-sort-" + _72.sortOrder;
                if ($(this).hasClass("datagrid-sort-asc")) {
                    cls = "datagrid-sort-desc";
                    _72.sortOrder = "desc";
                } else {
                    if ($(this).hasClass("datagrid-sort-desc")) {
                        cls = "datagrid-sort-asc";
                        _72.sortOrder = "asc";
                    }
                }
                _74.removeClass("datagrid-sort-asc datagrid-sort-desc");
                $(this).addClass(cls);
                if (_72.remoteSort) {
                    _160(_6f);
                } else {
                    var _77 = $.data(_6f, "datagrid").data;
                    _bc(_6f, _77);
                }
                _72.onSortColumn.call(_6f, _72.sortName, _72.sortOrder);
            }
        }).bind("dblclick.datagrid", function (e) {
            var p1 = $(this).offset().left + 5;
            var p2 = $(this).offset().left + $(this)._outerWidth() - 5;
            var _78 = _72.resizeHandle == "right" ? (e.pageX > p2) : (_72.resizeHandle == "left" ? (e.pageX < p1) : (e.pageX < p1 || e.pageX > p2));
            if (_78) {
                var _79 = $(this).parent().attr("field");
                var col = _6d(_6f, _79);
                if (col.resizable == false) {
                    return;
                }
                $(_6f).datagrid("autoSizeColumn", _79);
                col.auto = false;
            }
        });
        var _7a = _72.resizeHandle == "right" ? "e" : (_72.resizeHandle == "left" ? "w" : "e,w");
        _74.each(function () {
            $(this).resizable({
                handles: _7a,
                disabled: ($(this).attr("resizable") ? $(this).attr("resizable") == "false" : false),
                minWidth: 25,
                onStartResize: function (e) {
                    _70.resizing = true;
                    _73.css("cursor", $("body").css("cursor"));
                    if (!_70.proxy) {
                        _70.proxy = $("<div class=\"datagrid-resize-proxy\"></div>").appendTo(dc.view);
                    }
                    _70.proxy.css({left: e.pageX - $(_71).offset().left - 1, display: "none"});
                    setTimeout(function () {
                        if (_70.proxy) {
                            _70.proxy.show();
                        }
                    }, 500);
                },
                onResize: function (e) {
                    _70.proxy.css({left: e.pageX - $(_71).offset().left - 1, display: "block"});
                    return false;
                },
                onStopResize: function (e) {
                    _73.css("cursor", "");
                    $(this).css("height", "");
                    var _7b = $(this).parent().attr("field");
                    var col = _6d(_6f, _7b);
                    col.width = $(this)._outerWidth();
                    col.boxWidth = parseInt(this.style.width);
                    col.auto = undefined;
                    _51(_6f, _7b);
                    _70.proxy.remove();
                    _70.proxy = null;
                    if ($(this).parents("div:first.datagrid-header").parent().hasClass("datagrid-view1")) {
                        _1e(_6f);
                    }
                    _87(_6f);
                    _72.onResizeColumn.call(_6f, _7b, col.width);
                    setTimeout(function () {
                        _70.resizing = false;
                    }, 0);
                }
            });
        });
        dc.body1.add(dc.body2).unbind().bind("mouseover", function (e) {
            if (_70.resizing) {
                return;
            }
            var tr = $(e.target).closest("tr.datagrid-row");
            if (!_7c(tr)) {
                return;
            }
            var _7d = _7e(tr);
            _de(_6f, _7d);
            e.stopPropagation();
        }).bind("mouseout", function (e) {
            var tr = $(e.target).closest("tr.datagrid-row");
            if (!_7c(tr)) {
                return;
            }
            var _7f = _7e(tr);
            _72.finder.getTr(_6f, _7f).removeClass("datagrid-row-over");
            e.stopPropagation();
        }).bind("click", function (e) {
            var tt = $(e.target);
            var tr = tt.closest("tr.datagrid-row");
            if (!_7c(tr)) {
                return;
            }
            var _80 = _7e(tr);
            if (tt.parent().hasClass("datagrid-cell-check")) {
                if (_72.singleSelect && _72.selectOnCheck) {
                    if (!_72.checkOnSelect) {
                        _101(_6f, true);
                    }
                    _eb(_6f, _80);
                } else {
                    if (tt.is(":checked")) {
                        _eb(_6f, _80);
                    } else {
                        _f3(_6f, _80);
                    }
                }
            } else {
                var row = _72.finder.getRow(_6f, _80);
                var td = tt.closest("td[field]", tr);
                if (td.length) {
                    var _81 = td.attr("field");
                    _72.onClickCell.call(_6f, _80, _81, row[_81]);
                }
                if (_72.singleSelect == true) {
                    _e3(_6f, _80);
                } else {
                    if (tr.hasClass("datagrid-row-selected")) {
                        _ec(_6f, _80);
                    } else {
                        _e3(_6f, _80);
                    }
                }
                _72.onClickRow.call(_6f, _80, row);
            }
            e.stopPropagation();
        }).bind("dblclick", function (e) {
            var tt = $(e.target);
            var tr = tt.closest("tr.datagrid-row");
            if (!_7c(tr)) {
                return;
            }
            var _82 = _7e(tr);
            var row = _72.finder.getRow(_6f, _82);
            var td = tt.closest("td[field]", tr);
            if (td.length) {
                var _83 = td.attr("field");
                _72.onDblClickCell.call(_6f, _82, _83, row[_83]);
            }
            _72.onDblClickRow.call(_6f, _82, row);
            e.stopPropagation();
        }).bind("contextmenu", function (e) {
            var tr = $(e.target).closest("tr.datagrid-row");
            if (!_7c(tr)) {
                return;
            }
            var _84 = _7e(tr);
            var row = _72.finder.getRow(_6f, _84);
            _72.onRowContextMenu.call(_6f, e, _84, row);
            e.stopPropagation();
        });
        dc.body2.bind("scroll", function () {
            var b1 = dc.view1.children("div.datagrid-body");
            b1.scrollTop($(this).scrollTop());
            var c1 = dc.body1.children(":first");
            var c2 = dc.body2.children(":first");
            if (c1.length && c2.length) {
                var _85 = c1.offset().top;
                var _86 = c2.offset().top;
                if (_85 != _86) {
                    b1.scrollTop(b1.scrollTop() + _85 - _86);
                }
            }
            dc.view2.children("div.datagrid-header,div.datagrid-footer")._scrollLeft($(this)._scrollLeft());
            dc.body2.children("table.datagrid-btable-frozen").css("left", -$(this)._scrollLeft());
        });
        function _7e(tr) {
            if (tr.attr("datagrid-row-index")) {
                return parseInt(tr.attr("datagrid-row-index"));
            } else {
                return tr.attr("node-id");
            }
        };
        function _7c(tr) {
            return tr.length && tr.parent().length;
        };
    };
    function _87(_88) {
        var _89 = $.data(_88, "datagrid").options;
        var dc = $.data(_88, "datagrid").dc;
        dc.body2.css("overflow-x", _89.fitColumns ? "hidden" : "");
        if (!_89.fitColumns) {
            return;
        }
        var _8a = dc.view2.children("div.datagrid-header");
        var _8b = 0;
        var _8c;
        var _8d = _6c(_88, false);
        for (var i = 0; i < _8d.length; i++) {
            var col = _6d(_88, _8d[i]);
            if (_8e(col)) {
                _8b += col.width;
                _8c = col;
            }
        }
        var _8f = _8a.children("div.datagrid-header-inner").show();
        var _90 = _8a.width() - _8a.find("table").width() - _89.scrollbarSize;
        var _91 = _90 / _8b;
        if (!_89.showHeader) {
            _8f.hide();
        }
        for (var i = 0; i < _8d.length; i++) {
            var col = _6d(_88, _8d[i]);
            if (_8e(col)) {
                var _92 = Math.floor(col.width * _91);
                _93(col, _92);
                _90 -= _92;
            }
        }
        if (_90 && _8c) {
            _93(_8c, _90);
        }
        _51(_88);
        function _93(col, _94) {
            col.width += _94;
            col.boxWidth += _94;
            _8a.find("td[field=\"" + col.field + "\"] div.datagrid-cell").width(col.boxWidth);
        };
        function _8e(col) {
            if (!col.hidden && !col.checkbox && !col.auto && !col.fixed) {
                return true;
            }
        };
    };
    function _95(_96, _97) {
        var _98 = $.data(_96, "datagrid").options;
        var dc = $.data(_96, "datagrid").dc;
        if (_97) {
            _19(_97);
            if (_98.fitColumns) {
                _1e(_96);
                _87(_96);
            }
        } else {
            var _99 = false;
            var _9a = _6c(_96, true).concat(_6c(_96, false));
            for (var i = 0; i < _9a.length; i++) {
                var _97 = _9a[i];
                var col = _6d(_96, _97);
                if (col.auto) {
                    _19(_97);
                    _99 = true;
                }
            }
            if (_99 && _98.fitColumns) {
                _1e(_96);
                _87(_96);
            }
        }
        function _19(_9b) {
            var _9c = dc.view.find("div.datagrid-header td[field=\"" + _9b + "\"] div.datagrid-cell");
            _9c.css("width", "");
            var col = $(_96).datagrid("getColumnOption", _9b);
            col.width = undefined;
            col.boxWidth = undefined;
            col.auto = true;
            $(_96).datagrid("fixColumnSize", _9b);
            var _9d = Math.max(_9c._outerWidth(), _9e("allbody"), _9e("allfooter"));
            _9c._outerWidth(_9d);
            col.width = _9d;
            col.boxWidth = parseInt(_9c[0].style.width);
            $(_96).datagrid("fixColumnSize", _9b);
            _98.onResizeColumn.call(_96, _9b, col.width);
            function _9e(_9f) {
                var _a0 = 0;
                _98.finder.getTr(_96, 0, _9f).find("td[field=\"" + _9b + "\"] div.datagrid-cell").each(function () {
                    var w = $(this)._outerWidth();
                    if (_a0 < w) {
                        _a0 = w;
                    }
                });
                return _a0;
            };
        };
    };
    function _51(_a1, _a2) {
        var _a3 = $.data(_a1, "datagrid");
        var _a4 = _a3.options;
        var dc = _a3.dc;
        var _a5 = dc.view.find("table.datagrid-btable,table.datagrid-ftable");
        _a5.css("table-layout", "fixed");
        if (_a2) {
            fix(_a2);
        } else {
            var ff = _6c(_a1, true).concat(_6c(_a1, false));
            for (var i = 0; i < ff.length; i++) {
                fix(ff[i]);
            }
        }
        _a5.css("table-layout", "auto");
        _a6(_a1);
        setTimeout(function () {
            _2e(_a1);
            _ab(_a1);
        }, 0);
        function fix(_a7) {
            var col = _6d(_a1, _a7);
            if (!col.checkbox) {
                _a3.ss.set("." + col.cellClass, col.boxWidth ? col.boxWidth + "px" : "auto");
            }
        };
    };
    function _a6(_a8) {
        var dc = $.data(_a8, "datagrid").dc;
        dc.body1.add(dc.body2).find("td.datagrid-td-merged").each(function () {
            var td = $(this);
            var _a9 = td.attr("colspan") || 1;
            var _aa = _6d(_a8, td.attr("field")).width;
            for (var i = 1; i < _a9; i++) {
                td = td.next();
                _aa += _6d(_a8, td.attr("field")).width + 1;
            }
            $(this).children("div.datagrid-cell")._outerWidth(_aa);
        });
    };
    function _ab(_ac) {
        var dc = $.data(_ac, "datagrid").dc;
        dc.view.find("div.datagrid-editable").each(function () {
            var _ad = $(this);
            var _ae = _ad.parent().attr("field");
            var col = $(_ac).datagrid("getColumnOption", _ae);
            _ad._outerWidth(col.width);
            var ed = $.data(this, "datagrid.editor");
            if (ed.actions.resize) {
                ed.actions.resize(ed.target, _ad.width());
            }
        });
    };
    function _6d(_af, _b0) {
        function _b1(_b2) {
            if (_b2) {
                for (var i = 0; i < _b2.length; i++) {
                    var cc = _b2[i];
                    for (var j = 0; j < cc.length; j++) {
                        var c = cc[j];
                        if (c.field == _b0) {
                            return c;
                        }
                    }
                }
            }
            return null;
        };
        var _b3 = $.data(_af, "datagrid").options;
        var col = _b1(_b3.columns);
        if (!col) {
            col = _b1(_b3.frozenColumns);
        }
        return col;
    };
    function _6c(_b4, _b5) {
        var _b6 = $.data(_b4, "datagrid").options;
        var _b7 = (_b5 == true) ? (_b6.frozenColumns || [[]]) : _b6.columns;
        if (_b7.length == 0) {
            return [];
        }
        var _b8 = [];

        function _b9(_ba) {
            var c = 0;
            var i = 0;
            while (true) {
                if (_b8[i] == undefined) {
                    if (c == _ba) {
                        return i;
                    }
                    c++;
                }
                i++;
            }
        };
        function _bb(r) {
            var ff = [];
            var c = 0;
            for (var i = 0; i < _b7[r].length; i++) {
                var col = _b7[r][i];
                if (col.field) {
                    ff.push([c, col.field]);
                }
                c += parseInt(col.colspan || "1");
            }
            for (var i = 0; i < ff.length; i++) {
                ff[i][0] = _b9(ff[i][0]);
            }
            for (var i = 0; i < ff.length; i++) {
                var f = ff[i];
                _b8[f[0]] = f[1];
            }
        };
        for (var i = 0; i < _b7.length; i++) {
            _bb(i);
        }
        return _b8;
    };
    function _bc(_bd, _be) {
        var _bf = $.data(_bd, "datagrid");
        var _c0 = _bf.options;
        var dc = _bf.dc;
        _be = _c0.loadFilter.call(_bd, _be);
        _be.total = parseInt(_be.total);
        _bf.data = _be;
        if (_be.footer) {
            _bf.footer = _be.footer;
        }
        if (!_c0.remoteSort) {
            var opt = _6d(_bd, _c0.sortName);
            if (opt) {
                var _c1 = opt.sorter || function (a, b) {
                        return (a > b ? 1 : -1);
                    };
                _be.rows.sort(function (r1, r2) {
                    return _c1(r1[_c0.sortName], r2[_c0.sortName]) * (_c0.sortOrder == "asc" ? 1 : -1);
                });
            }
        }
        if (_c0.view.onBeforeRender) {
            _c0.view.onBeforeRender.call(_c0.view, _bd, _be.rows);
        }
        _c0.view.render.call(_c0.view, _bd, dc.body2, false);
        _c0.view.render.call(_c0.view, _bd, dc.body1, true);
        if (_c0.showFooter) {
            _c0.view.renderFooter.call(_c0.view, _bd, dc.footer2, false);
            _c0.view.renderFooter.call(_c0.view, _bd, dc.footer1, true);
        }
        if (_c0.view.onAfterRender) {
            _c0.view.onAfterRender.call(_c0.view, _bd);
        }
        _bf.ss.clean();
        _c0.onLoadSuccess.call(_bd, _be);
        var _c2 = $(_bd).datagrid("getPager");
        if (_c2.length) {
            if (_c2.pagination("options").total != _be.total) {
                _c2.pagination("refresh", {total: _be.total});
            }
        }
        _2e(_bd);
        dc.body2.triggerHandler("scroll");
        _c3();
        $(_bd).datagrid("autoSizeColumn");
        function _c3() {
            if (_c0.idField) {
                for (var i = 0; i < _be.rows.length; i++) {
                    var row = _be.rows[i];
                    if (_c4(_bf.selectedRows, row)) {
                        _c0.finder.getTr(_bd, i).addClass("datagrid-row-selected");
                    }
                    if (_c4(_bf.checkedRows, row)) {
                        _c0.finder.getTr(_bd, i).find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true);
                    }
                }
            }
            function _c4(a, r) {
                for (var i = 0; i < a.length; i++) {
                    if (a[i][_c0.idField] == r[_c0.idField]) {
                        a[i] = r;
                        return true;
                    }
                }
                return false;
            };
        };
    };
    function _c5(_c6, row) {
        var _c7 = $.data(_c6, "datagrid");
        var _c8 = _c7.options;
        var _c9 = _c7.data.rows;
        if (typeof row == "object") {
            return _2(_c9, row);
        } else {
            for (var i = 0; i < _c9.length; i++) {
                if (_c9[i][_c8.idField] == row) {
                    return i;
                }
            }
            return -1;
        }
    };
    function _ca(_cb) {
        var _cc = $.data(_cb, "datagrid");
        var _cd = _cc.options;
        var _ce = _cc.data;
        if (_cd.idField) {
            return _cc.selectedRows;
        } else {
            var _cf = [];
            _cd.finder.getTr(_cb, "", "selected", 2).each(function () {
                var _d0 = parseInt($(this).attr("datagrid-row-index"));
                _cf.push(_ce.rows[_d0]);
            });
            return _cf;
        }
    };
    function _d1(_d2) {
        var _d3 = $.data(_d2, "datagrid");
        var _d4 = _d3.options;
        if (_d4.idField) {
            return _d3.checkedRows;
        } else {
            var _d5 = [];
            _d4.finder.getTr(_d2, "", "checked").each(function () {
                _d5.push(_d4.finder.getRow(_d2, $(this)));
            });
            return _d5;
        }
    };
    function _d6(_d7, _d8) {
        var _d9 = $.data(_d7, "datagrid");
        var dc = _d9.dc;
        var _da = _d9.options;
        var tr = _da.finder.getTr(_d7, _d8);
        if (tr.length) {
            if (tr.closest("table").hasClass("datagrid-btable-frozen")) {
                return;
            }
            var _db = dc.view2.children("div.datagrid-header")._outerHeight();
            var _dc = dc.body2;
            var _dd = _dc.outerHeight(true) - _dc.outerHeight();
            var top = tr.position().top - _db - _dd;
            if (top < 0) {
                _dc.scrollTop(_dc.scrollTop() + top);
            } else {
                if (top + tr._outerHeight() > _dc.height() - 18) {
                    _dc.scrollTop(_dc.scrollTop() + top + tr._outerHeight() - _dc.height() + 18);
                }
            }
        }
    };
    function _de(_df, _e0) {
        var _e1 = $.data(_df, "datagrid");
        var _e2 = _e1.options;
        _e2.finder.getTr(_df, _e1.highlightIndex).removeClass("datagrid-row-over");
        _e2.finder.getTr(_df, _e0).addClass("datagrid-row-over");
        _e1.highlightIndex = _e0;
    };
    function _e3(_e4, _e5, _e6) {
        var _e7 = $.data(_e4, "datagrid");
        var dc = _e7.dc;
        var _e8 = _e7.options;
        var _e9 = _e7.selectedRows;
        if (_e8.singleSelect) {
            _ea(_e4);
            _e9.splice(0, _e9.length);
        }
        if (!_e6 && _e8.checkOnSelect) {
            _eb(_e4, _e5, true);
        }
        var row = _e8.finder.getRow(_e4, _e5);
        if (_e8.idField) {
            _7(_e9, _e8.idField, row);
        }
        _e8.finder.getTr(_e4, _e5).addClass("datagrid-row-selected");
        _e8.onSelect.call(_e4, _e5, row);
        _d6(_e4, _e5);
    };
    function _ec(_ed, _ee, _ef) {
        var _f0 = $.data(_ed, "datagrid");
        var dc = _f0.dc;
        var _f1 = _f0.options;
        var _f2 = $.data(_ed, "datagrid").selectedRows;
        if (!_ef && _f1.checkOnSelect) {
            _f3(_ed, _ee, true);
        }
        _f1.finder.getTr(_ed, _ee).removeClass("datagrid-row-selected");
        var row = _f1.finder.getRow(_ed, _ee);
        if (_f1.idField) {
            _4(_f2, _f1.idField, row[_f1.idField]);
        }
        _f1.onUnselect.call(_ed, _ee, row);
    };
    function _f4(_f5, _f6) {
        var _f7 = $.data(_f5, "datagrid");
        var _f8 = _f7.options;
        var _f9 = _f7.data.rows;
        var _fa = $.data(_f5, "datagrid").selectedRows;
        if (!_f6 && _f8.checkOnSelect) {
            _fb(_f5, true);
        }
        _f8.finder.getTr(_f5, "", "allbody").addClass("datagrid-row-selected");
        if (_f8.idField) {
            for (var _fc = 0; _fc < _f9.length; _fc++) {
                _7(_fa, _f8.idField, _f9[_fc]);
            }
        }
        _f8.onSelectAll.call(_f5, _f9);
    };
    function _ea(_fd, _fe) {
        var _ff = $.data(_fd, "datagrid");
        var opts = _ff.options;
        var rows = _ff.data.rows;
        var _100 = $.data(_fd, "datagrid").selectedRows;
        if (!_fe && opts.checkOnSelect) {
            _101(_fd, true);
        }
        opts.finder.getTr(_fd, "", "selected").removeClass("datagrid-row-selected");
        if (opts.idField) {
            for (var _102 = 0; _102 < rows.length; _102++) {
                _4(_100, opts.idField, rows[_102][opts.idField]);
            }
        }
        opts.onUnselectAll.call(_fd, rows);
    };
    function _eb(_103, _104, _105) {
        var _106 = $.data(_103, "datagrid");
        var opts = _106.options;
        if (!_105 && opts.selectOnCheck) {
            _e3(_103, _104, true);
        }
        var ck = opts.finder.getTr(_103, _104).find("div.datagrid-cell-check input[type=checkbox]");
        ck._propAttr("checked", true);
        ck = opts.finder.getTr(_103, "", "checked");
        if (ck.length == _106.data.rows.length) {
            var dc = _106.dc;
            var _107 = dc.header1.add(dc.header2);
            _107.find("input[type=checkbox]")._propAttr("checked", true);
        }
        var row = opts.finder.getRow(_103, _104);
        if (opts.idField) {
            _7(_106.checkedRows, opts.idField, row);
        }
        opts.onCheck.call(_103, _104, row);
    };
    function _f3(_108, _109, _10a) {
        var _10b = $.data(_108, "datagrid");
        var opts = _10b.options;
        if (!_10a && opts.selectOnCheck) {
            _ec(_108, _109, true);
        }
        var ck = opts.finder.getTr(_108, _109).find("div.datagrid-cell-check input[type=checkbox]");
        ck._propAttr("checked", false);
        var dc = _10b.dc;
        var _10c = dc.header1.add(dc.header2);
        _10c.find("input[type=checkbox]")._propAttr("checked", false);
        var row = opts.finder.getRow(_108, _109);
        if (opts.idField) {
            _4(_10b.checkedRows, opts.idField, row[opts.idField]);
        }
        opts.onUncheck.call(_108, _109, row);
    };
    function _fb(_10d, _10e) {
        var _10f = $.data(_10d, "datagrid");
        var opts = _10f.options;
        var rows = _10f.data.rows;
        if (!_10e && opts.selectOnCheck) {
            _f4(_10d, true);
        }
        var dc = _10f.dc;
        var hck = dc.header1.add(dc.header2).find("input[type=checkbox]");
        var bck = opts.finder.getTr(_10d, "", "allbody").find("div.datagrid-cell-check input[type=checkbox]");
        hck.add(bck)._propAttr("checked", true);
        if (opts.idField) {
            for (var i = 0; i < rows.length; i++) {
                _7(_10f.checkedRows, opts.idField, rows[i]);
            }
        }
        opts.onCheckAll.call(_10d, rows);
    };
    function _101(_110, _111) {
        var _112 = $.data(_110, "datagrid");
        var opts = _112.options;
        var rows = _112.data.rows;
        if (!_111 && opts.selectOnCheck) {
            _ea(_110, true);
        }
        var dc = _112.dc;
        var hck = dc.header1.add(dc.header2).find("input[type=checkbox]");
        var bck = opts.finder.getTr(_110, "", "allbody").find("div.datagrid-cell-check input[type=checkbox]");
        hck.add(bck)._propAttr("checked", false);
        if (opts.idField) {
            for (var i = 0; i < rows.length; i++) {
                _4(_112.checkedRows, opts.idField, rows[i][opts.idField]);
            }
        }
        opts.onUncheckAll.call(_110, rows);
    };
    function _113(_114, _115) {
        var opts = $.data(_114, "datagrid").options;
        var tr = opts.finder.getTr(_114, _115);
        var row = opts.finder.getRow(_114, _115);
        if (tr.hasClass("datagrid-row-editing")) {
            return;
        }
        if (opts.onBeforeEdit.call(_114, _115, row) == false) {
            return;
        }
        tr.addClass("datagrid-row-editing");
        _116(_114, _115);
        _ab(_114);
        tr.find("div.datagrid-editable").each(function () {
            var _117 = $(this).parent().attr("field");
            var ed = $.data(this, "datagrid.editor");
            ed.actions.setValue(ed.target, row[_117]);
        });
        _118(_114, _115);
    };
    function _119(_11a, _11b, _11c) {
        var opts = $.data(_11a, "datagrid").options;
        var _11d = $.data(_11a, "datagrid").updatedRows;
        var _11e = $.data(_11a, "datagrid").insertedRows;
        var tr = opts.finder.getTr(_11a, _11b);
        var row = opts.finder.getRow(_11a, _11b);
        if (!tr.hasClass("datagrid-row-editing")) {
            return;
        }
        if (!_11c) {
            if (!_118(_11a, _11b)) {
                return;
            }
            var _11f = false;
            var _120 = {};
            tr.find("div.datagrid-editable").each(function () {
                var _121 = $(this).parent().attr("field");
                var ed = $.data(this, "datagrid.editor");
                var _122 = ed.actions.getValue(ed.target);
                if (row[_121] != _122) {
                    row[_121] = _122;
                    _11f = true;
                    _120[_121] = _122;
                }
            });
            if (_11f) {
                if (_2(_11e, row) == -1) {
                    if (_2(_11d, row) == -1) {
                        _11d.push(row);
                    }
                }
            }
        }
        tr.removeClass("datagrid-row-editing");
        _123(_11a, _11b);
        $(_11a).datagrid("refreshRow", _11b);
        if (!_11c) {
            opts.onAfterEdit.call(_11a, _11b, row, _120);
        } else {
            opts.onCancelEdit.call(_11a, _11b, row);
        }
    };
    function _124(_125, _126) {
        var opts = $.data(_125, "datagrid").options;
        var tr = opts.finder.getTr(_125, _126);
        var _127 = [];
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-editable");
            if (cell.length) {
                var ed = $.data(cell[0], "datagrid.editor");
                _127.push(ed);
            }
        });
        return _127;
    };
    function _128(_129, _12a) {
        var _12b = _124(_129, _12a.index);
        for (var i = 0; i < _12b.length; i++) {
            if (_12b[i].field == _12a.field) {
                return _12b[i];
            }
        }
        return null;
    };
    function _116(_12c, _12d) {
        var opts = $.data(_12c, "datagrid").options;
        var tr = opts.finder.getTr(_12c, _12d);
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-cell");
            var _12e = $(this).attr("field");
            var col = _6d(_12c, _12e);
            if (col && col.editor) {
                var _12f, _130;
                if (typeof col.editor == "string") {
                    _12f = col.editor;
                } else {
                    _12f = col.editor.type;
                    _130 = col.editor.options;
                }
                var _131 = opts.editors[_12f];
                if (_131) {
                    var _132 = cell.html();
                    var _133 = cell._outerWidth();
                    cell.addClass("datagrid-editable");
                    cell._outerWidth(_133);
                    cell.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>");
                    cell.children("table").bind("click dblclick contextmenu", function (e) {
                        e.stopPropagation();
                    });
                    $.data(cell[0], "datagrid.editor", {
                        actions: _131,
                        target: _131.init(cell.find("td"), _130),
                        field: _12e,
                        type: _12f,
                        oldHtml: _132
                    });
                }
            }
        });
        _2e(_12c, _12d, true);
    };
    function _123(_134, _135) {
        var opts = $.data(_134, "datagrid").options;
        var tr = opts.finder.getTr(_134, _135);
        tr.children("td").each(function () {
            var cell = $(this).find("div.datagrid-editable");
            if (cell.length) {
                var ed = $.data(cell[0], "datagrid.editor");
                if (ed.actions.destroy) {
                    ed.actions.destroy(ed.target);
                }
                cell.html(ed.oldHtml);
                $.removeData(cell[0], "datagrid.editor");
                cell.removeClass("datagrid-editable");
                cell.css("width", "");
            }
        });
    };
    function _118(_136, _137) {
        var tr = $.data(_136, "datagrid").options.finder.getTr(_136, _137);
        if (!tr.hasClass("datagrid-row-editing")) {
            return true;
        }
        var vbox = tr.find(".validatebox-text");
        vbox.validatebox("validate");
        vbox.trigger("mouseleave");
        var _138 = tr.find(".validatebox-invalid");
        return _138.length == 0;
    };
    function _139(_13a, _13b) {
        var _13c = $.data(_13a, "datagrid").insertedRows;
        var _13d = $.data(_13a, "datagrid").deletedRows;
        var _13e = $.data(_13a, "datagrid").updatedRows;
        if (!_13b) {
            var rows = [];
            rows = rows.concat(_13c);
            rows = rows.concat(_13d);
            rows = rows.concat(_13e);
            return rows;
        } else {
            if (_13b == "inserted") {
                return _13c;
            } else {
                if (_13b == "deleted") {
                    return _13d;
                } else {
                    if (_13b == "updated") {
                        return _13e;
                    }
                }
            }
        }
        return [];
    };
    function _13f(_140, _141) {
        var _142 = $.data(_140, "datagrid");
        var opts = _142.options;
        var data = _142.data;
        var _143 = _142.insertedRows;
        var _144 = _142.deletedRows;
        $(_140).datagrid("cancelEdit", _141);
        var row = data.rows[_141];
        if (_2(_143, row) >= 0) {
            _4(_143, row);
        } else {
            _144.push(row);
        }
        _4(_142.selectedRows, opts.idField, data.rows[_141][opts.idField]);
        _4(_142.checkedRows, opts.idField, data.rows[_141][opts.idField]);
        opts.view.deleteRow.call(opts.view, _140, _141);
        if (opts.height == "auto") {
            _2e(_140);
        }
        $(_140).datagrid("getPager").pagination("refresh", {total: data.total});
    };
    function _145(_146, _147) {
        var data = $.data(_146, "datagrid").data;
        var view = $.data(_146, "datagrid").options.view;
        var _148 = $.data(_146, "datagrid").insertedRows;
        view.insertRow.call(view, _146, _147.index, _147.row);
        _148.push(_147.row);
        $(_146).datagrid("getPager").pagination("refresh", {total: data.total});
    };
    function _149(_14a, row) {
        var data = $.data(_14a, "datagrid").data;
        var view = $.data(_14a, "datagrid").options.view;
        var _14b = $.data(_14a, "datagrid").insertedRows;
        view.insertRow.call(view, _14a, null, row);
        _14b.push(row);
        $(_14a).datagrid("getPager").pagination("refresh", {total: data.total});
    };
    function _14c(_14d) {
        var _14e = $.data(_14d, "datagrid");
        var data = _14e.data;
        var rows = data.rows;
        var _14f = [];
        for (var i = 0; i < rows.length; i++) {
            _14f.push($.extend({}, rows[i]));
        }
        _14e.originalRows = _14f;
        _14e.updatedRows = [];
        _14e.insertedRows = [];
        _14e.deletedRows = [];
    };
    function _150(_151) {
        var data = $.data(_151, "datagrid").data;
        var ok = true;
        for (var i = 0, len = data.rows.length; i < len; i++) {
            if (_118(_151, i)) {
                _119(_151, i, false);
            } else {
                ok = false;
            }
        }
        if (ok) {
            _14c(_151);
        }
    };
    function _152(_153) {
        var _154 = $.data(_153, "datagrid");
        var opts = _154.options;
        var _155 = _154.originalRows;
        var _156 = _154.insertedRows;
        var _157 = _154.deletedRows;
        var _158 = _154.selectedRows;
        var _159 = _154.checkedRows;
        var data = _154.data;

        function _15a(a) {
            var ids = [];
            for (var i = 0; i < a.length; i++) {
                ids.push(a[i][opts.idField]);
            }
            return ids;
        };
        function _15b(ids, _15c) {
            for (var i = 0; i < ids.length; i++) {
                var _15d = _c5(_153, ids[i]);
                if (_15d >= 0) {
                    (_15c == "s" ? _e3 : _eb)(_153, _15d, true);
                }
            }
        };
        for (var i = 0; i < data.rows.length; i++) {
            _119(_153, i, true);
        }
        var _15e = _15a(_158);
        var _15f = _15a(_159);
        _158.splice(0, _158.length);
        _159.splice(0, _159.length);
        data.total += _157.length - _156.length;
        data.rows = _155;
        _bc(_153, data);
        _15b(_15e, "s");
        _15b(_15f, "c");
        _14c(_153);
    };
    function _160(_161, _162) {
        var opts = $.data(_161, "datagrid").options;
        if (_162) {
            opts.queryParams = _162;
        }
        var _163 = $.extend({}, opts.queryParams);
        if (opts.pagination) {
            $.extend(_163, {page: opts.pageNumber, rows: opts.pageSize});
        }
        if (opts.sortName) {
            $.extend(_163, {sort: opts.sortName, order: opts.sortOrder});
        }
        if (opts.onBeforeLoad.call(_161, _163) == false) {
            return;
        }
        $(_161).datagrid("loading");
        setTimeout(function () {
            _164();
        }, 0);
        function _164() {
            var _165 = opts.loader.call(_161, _163, function (data) {
                setTimeout(function () {
                    $(_161).datagrid("loaded");
                }, 0);
                _bc(_161, data);
                setTimeout(function () {
                    _14c(_161);
                }, 0);
            }, function () {
                setTimeout(function () {
                    $(_161).datagrid("loaded");
                }, 0);
                opts.onLoadError.apply(_161, arguments);
            });
            if (_165 == false) {
                $(_161).datagrid("loaded");
            }
        };
    };
    function _166(_167, _168) {
        var opts = $.data(_167, "datagrid").options;
        _168.rowspan = _168.rowspan || 1;
        _168.colspan = _168.colspan || 1;
        if (_168.rowspan == 1 && _168.colspan == 1) {
            return;
        }
        var tr = opts.finder.getTr(_167, (_168.index != undefined ? _168.index : _168.id));
        if (!tr.length) {
            return;
        }
        var row = opts.finder.getRow(_167, tr);
        var _169 = row[_168.field];
        var td = tr.find("td[field=\"" + _168.field + "\"]");
        td.attr("rowspan", _168.rowspan).attr("colspan", _168.colspan);
        td.addClass("datagrid-td-merged");
        for (var i = 1; i < _168.colspan; i++) {
            td = td.next();
            td.hide();
            row[td.attr("field")] = _169;
        }
        for (var i = 1; i < _168.rowspan; i++) {
            tr = tr.next();
            if (!tr.length) {
                break;
            }
            var row = opts.finder.getRow(_167, tr);
            var td = tr.find("td[field=\"" + _168.field + "\"]").hide();
            row[td.attr("field")] = _169;
            for (var j = 1; j < _168.colspan; j++) {
                td = td.next();
                td.hide();
                row[td.attr("field")] = _169;
            }
        }
        _a6(_167);
    };
    $.fn.datagrid = function (_16a, _16b) {
        if (typeof _16a == "string") {
            return $.fn.datagrid.methods[_16a](this, _16b);
        }
        _16a = _16a || {};
        return this.each(function () {
            var _16c = $.data(this, "datagrid");
            var opts;
            if (_16c) {
                opts = $.extend(_16c.options, _16a);
                _16c.options = opts;
            } else {
                opts = $.extend({}, $.extend({}, $.fn.datagrid.defaults, {queryParams: {}}), $.fn.datagrid.parseOptions(this), _16a);
                $(this).css("width", "").css("height", "");
                var _16d = _47(this, opts.rownumbers);
                if (!opts.columns) {
                    opts.columns = _16d.columns;
                }
                if (!opts.frozenColumns) {
                    opts.frozenColumns = _16d.frozenColumns;
                }
                opts.columns = $.extend(true, [], opts.columns);
                opts.frozenColumns = $.extend(true, [], opts.frozenColumns);
                opts.view = $.extend({}, opts.view);
                $.data(this, "datagrid", {
                    options: opts,
                    panel: _16d.panel,
                    dc: _16d.dc,
                    ss: _16d.ss,
                    selectedRows: [],
                    checkedRows: [],
                    data: {total: 0, rows: []},
                    originalRows: [],
                    updatedRows: [],
                    insertedRows: [],
                    deletedRows: []
                });
            }
            _56(this);
            if (opts.data) {
                _bc(this, opts.data);
                _14c(this);
            } else {
                var data = $.fn.datagrid.parseData(this);
                if (data.total > 0) {
                    _bc(this, data);
                    _14c(this);
                }
            }
            _19(this);
            _160(this);
            _6e(this);
        });
    };
    var _16e = {
        text: {
            init: function (_16f, _170) {
                var _171 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_16f);
                return _171;
            }, getValue: function (_172) {
                return $(_172).val();
            }, setValue: function (_173, _174) {
                $(_173).val(_174);
            }, resize: function (_175, _176) {
                $(_175)._outerWidth(_176);
            }
        }, textarea: {
            init: function (_177, _178) {
                var _179 = $("<textarea class=\"datagrid-editable-input\"></textarea>").appendTo(_177);
                return _179;
            }, getValue: function (_17a) {
                return $(_17a).val();
            }, setValue: function (_17b, _17c) {
                $(_17b).val(_17c);
            }, resize: function (_17d, _17e) {
                $(_17d)._outerWidth(_17e);
            }
        }, checkbox: {
            init: function (_17f, _180) {
                var _181 = $("<input type=\"checkbox\">").appendTo(_17f);
                _181.val(_180.on);
                _181.attr("offval", _180.off);
                return _181;
            }, getValue: function (_182) {
                if ($(_182).is(":checked")) {
                    return $(_182).val();
                } else {
                    return $(_182).attr("offval");
                }
            }, setValue: function (_183, _184) {
                var _185 = false;
                if ($(_183).val() == _184) {
                    _185 = true;
                }
                $(_183)._propAttr("checked", _185);
            }
        }, numberbox: {
            init: function (_186, _187) {
                var _188 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_186);
                _188.numberbox(_187);
                return _188;
            }, destroy: function (_189) {
                $(_189).numberbox("destroy");
            }, getValue: function (_18a) {
                $(_18a).blur();
                return $(_18a).numberbox("getValue");
            }, setValue: function (_18b, _18c) {
                $(_18b).numberbox("setValue", _18c);
            }, resize: function (_18d, _18e) {
                $(_18d)._outerWidth(_18e);
            }
        }, validatebox: {
            init: function (_18f, _190) {
                var _191 = $("<input type=\"text\" class=\"datagrid-editable-input\">").appendTo(_18f);
                _191.validatebox(_190);
                return _191;
            }, destroy: function (_192) {
                $(_192).validatebox("destroy");
            }, getValue: function (_193) {
                return $(_193).val();
            }, setValue: function (_194, _195) {
                $(_194).val(_195);
            }, resize: function (_196, _197) {
                $(_196)._outerWidth(_197);
            }
        }, datebox: {
            init: function (_198, _199) {
                var _19a = $("<input type=\"text\">").appendTo(_198);
                _19a.datebox(_199);
                return _19a;
            }, destroy: function (_19b) {
                $(_19b).datebox("destroy");
            }, getValue: function (_19c) {
                return $(_19c).datebox("getValue");
            }, setValue: function (_19d, _19e) {
                $(_19d).datebox("setValue", _19e);
            }, resize: function (_19f, _1a0) {
                $(_19f).datebox("resize", _1a0);
            }
        }, combobox: {
            init: function (_1a1, _1a2) {
                var _1a3 = $("<input type=\"text\">").appendTo(_1a1);
                _1a3.combobox(_1a2 || {});
                return _1a3;
            }, destroy: function (_1a4) {
                $(_1a4).combobox("destroy");
            }, getValue: function (_1a5) {
                return $(_1a5).combobox("getValue");
            }, setValue: function (_1a6, _1a7) {
                $(_1a6).combobox("setValue", _1a7);
            }, resize: function (_1a8, _1a9) {
                $(_1a8).combobox("resize", _1a9);
            }
        }, combotree: {
            init: function (_1aa, _1ab) {
                var _1ac = $("<input type=\"text\">").appendTo(_1aa);
                _1ac.combotree(_1ab);
                return _1ac;
            }, destroy: function (_1ad) {
                $(_1ad).combotree("destroy");
            }, getValue: function (_1ae) {
                return $(_1ae).combotree("getValue");
            }, setValue: function (_1af, _1b0) {
                $(_1af).combotree("setValue", _1b0);
            }, resize: function (_1b1, _1b2) {
                $(_1b1).combotree("resize", _1b2);
            }
        }
    };
    $.fn.datagrid.methods = {
        options: function (jq) {
            var _1b3 = $.data(jq[0], "datagrid").options;
            var _1b4 = $.data(jq[0], "datagrid").panel.panel("options");
            var opts = $.extend(_1b3, {
                width: _1b4.width,
                height: _1b4.height,
                closed: _1b4.closed,
                collapsed: _1b4.collapsed,
                minimized: _1b4.minimized,
                maximized: _1b4.maximized
            });
            return opts;
        }, getPanel: function (jq) {
            return $.data(jq[0], "datagrid").panel;
        }, getPager: function (jq) {
            return $.data(jq[0], "datagrid").panel.children("div.datagrid-pager");
        }, getColumnFields: function (jq, _1b5) {
            return _6c(jq[0], _1b5);
        }, getColumnOption: function (jq, _1b6) {
            return _6d(jq[0], _1b6);
        }, resize: function (jq, _1b7) {
            return jq.each(function () {
                _19(this, _1b7);
            });
        }, load: function (jq, _1b8) {
            return jq.each(function () {
                var opts = $(this).datagrid("options");
                opts.pageNumber = 1;
                var _1b9 = $(this).datagrid("getPager");
                _1b9.pagination({pageNumber: 1});
                _160(this, _1b8);
            });
        }, reload: function (jq, _1ba) {
            return jq.each(function () {
                _160(this, _1ba);
            });
        }, reloadFooter: function (jq, _1bb) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                var dc = $.data(this, "datagrid").dc;
                if (_1bb) {
                    $.data(this, "datagrid").footer = _1bb;
                }
                if (opts.showFooter) {
                    opts.view.renderFooter.call(opts.view, this, dc.footer2, false);
                    opts.view.renderFooter.call(opts.view, this, dc.footer1, true);
                    if (opts.view.onAfterRender) {
                        opts.view.onAfterRender.call(opts.view, this);
                    }
                    $(this).datagrid("fixRowHeight");
                }
            });
        }, loading: function (jq) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                $(this).datagrid("getPager").pagination("loading");
                if (opts.loadMsg) {
                    var _1bc = $(this).datagrid("getPanel");
                    $("<div class=\"datagrid-mask\" style=\"display:block\"></div>").appendTo(_1bc);
                    var msg = $("<div class=\"datagrid-mask-msg\" style=\"display:block;left:50%\"></div>").html(opts.loadMsg).appendTo(_1bc);
                    msg.css("marginLeft", -msg.outerWidth() / 2);
                }
            });
        }, loaded: function (jq) {
            return jq.each(function () {
                $(this).datagrid("getPager").pagination("loaded");
                var _1bd = $(this).datagrid("getPanel");
                _1bd.children("div.datagrid-mask-msg").remove();
                _1bd.children("div.datagrid-mask").remove();
            });
        }, fitColumns: function (jq) {
            return jq.each(function () {
                _87(this);
            });
        }, fixColumnSize: function (jq, _1be) {
            return jq.each(function () {
                _51(this, _1be);
            });
        }, fixRowHeight: function (jq, _1bf) {
            return jq.each(function () {
                _2e(this, _1bf);
            });
        }, freezeRow: function (jq, _1c0) {
            return jq.each(function () {
                _3f(this, _1c0);
            });
        }, autoSizeColumn: function (jq, _1c1) {
            return jq.each(function () {
                _95(this, _1c1);
            });
        }, loadData: function (jq, data) {
            return jq.each(function () {
                _bc(this, data);
                _14c(this);
            });
        }, getData: function (jq) {
            return $.data(jq[0], "datagrid").data;
        }, getRows: function (jq) {
            return $.data(jq[0], "datagrid").data.rows;
        }, getFooterRows: function (jq) {
            return $.data(jq[0], "datagrid").footer;
        }, getRowIndex: function (jq, id) {
            return _c5(jq[0], id);
        }, getChecked: function (jq) {
            return _d1(jq[0]);
        }, getSelected: function (jq) {
            var rows = _ca(jq[0]);
            return rows.length > 0 ? rows[0] : null;
        }, getSelections: function (jq) {
            return _ca(jq[0]);
        }, clearSelections: function (jq) {
            return jq.each(function () {
                var _1c2 = $.data(this, "datagrid").selectedRows;
                _1c2.splice(0, _1c2.length);
                _ea(this);
            });
        }, clearChecked: function (jq) {
            return jq.each(function () {
                var _1c3 = $.data(this, "datagrid").checkedRows;
                _1c3.splice(0, _1c3.length);
                _101(this);
            });
        }, scrollTo: function (jq, _1c4) {
            return jq.each(function () {
                _d6(this, _1c4);
            });
        }, highlightRow: function (jq, _1c5) {
            return jq.each(function () {
                _de(this, _1c5);
                _d6(this, _1c5);
            });
        }, selectAll: function (jq) {
            return jq.each(function () {
                _f4(this);
            });
        }, unselectAll: function (jq) {
            return jq.each(function () {
                _ea(this);
            });
        }, selectRow: function (jq, _1c6) {
            return jq.each(function () {
                _e3(this, _1c6);
            });
        }, selectRecord: function (jq, id) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                if (opts.idField) {
                    var _1c7 = _c5(this, id);
                    if (_1c7 >= 0) {
                        $(this).datagrid("selectRow", _1c7);
                    }
                }
            });
        }, unselectRow: function (jq, _1c8) {
            return jq.each(function () {
                _ec(this, _1c8);
            });
        }, checkRow: function (jq, _1c9) {
            return jq.each(function () {
                _eb(this, _1c9);
            });
        }, uncheckRow: function (jq, _1ca) {
            return jq.each(function () {
                _f3(this, _1ca);
            });
        }, checkAll: function (jq) {
            return jq.each(function () {
                _fb(this);
            });
        }, uncheckAll: function (jq) {
            return jq.each(function () {
                _101(this);
            });
        }, beginEdit: function (jq, _1cb) {
            return jq.each(function () {
                _113(this, _1cb);
            });
        }, endEdit: function (jq, _1cc) {
            return jq.each(function () {
                _119(this, _1cc, false);
            });
        }, cancelEdit: function (jq, _1cd) {
            return jq.each(function () {
                _119(this, _1cd, true);
            });
        }, getEditors: function (jq, _1ce) {
            return _124(jq[0], _1ce);
        }, getEditor: function (jq, _1cf) {
            return _128(jq[0], _1cf);
        }, refreshRow: function (jq, _1d0) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                opts.view.refreshRow.call(opts.view, this, _1d0);
            });
        }, validateRow: function (jq, _1d1) {
            return _118(jq[0], _1d1);
        }, updateRow: function (jq, _1d2) {
            return jq.each(function () {
                var opts = $.data(this, "datagrid").options;
                opts.view.updateRow.call(opts.view, this, _1d2.index, _1d2.row);
            });
        }, appendRow: function (jq, row) {
            return jq.each(function () {
                _149(this, row);
            });
        }, insertRow: function (jq, _1d3) {
            return jq.each(function () {
                _145(this, _1d3);
            });
        }, deleteRow: function (jq, _1d4) {
            return jq.each(function () {
                _13f(this, _1d4);
            });
        }, getChanges: function (jq, _1d5) {
            return _139(jq[0], _1d5);
        }, acceptChanges: function (jq) {
            return jq.each(function () {
                _150(this);
            });
        }, rejectChanges: function (jq) {
            return jq.each(function () {
                _152(this);
            });
        }, mergeCells: function (jq, _1d6) {
            return jq.each(function () {
                _166(this, _1d6);
            });
        }, showColumn: function (jq, _1d7) {
            return jq.each(function () {
                var _1d8 = $(this).datagrid("getPanel");
                _1d8.find("td[field=\"" + _1d7 + "\"]").show();
                $(this).datagrid("getColumnOption", _1d7).hidden = false;
                $(this).datagrid("fitColumns");
            });
        }, hideColumn: function (jq, _1d9) {
            return jq.each(function () {
                var _1da = $(this).datagrid("getPanel");
                _1da.find("td[field=\"" + _1d9 + "\"]").hide();
                $(this).datagrid("getColumnOption", _1d9).hidden = true;
                $(this).datagrid("fitColumns");
            });
        }
    };
    $.fn.datagrid.parseOptions = function (_1db) {
        var t = $(_1db);
        return $.extend({}, $.fn.panel.parseOptions(_1db), $.parser.parseOptions(_1db, ["url", "toolbar", "idField", "sortName", "sortOrder", "pagePosition", "resizeHandle", {
            fitColumns: "boolean",
            autoRowHeight: "boolean",
            striped: "boolean",
            nowrap: "boolean"
        }, {
            rownumbers: "boolean",
            singleSelect: "boolean",
            checkOnSelect: "boolean",
            selectOnCheck: "boolean"
        }, {pagination: "boolean", pageSize: "number", pageNumber: "number"}, {
            remoteSort: "boolean",
            showHeader: "boolean",
            showFooter: "boolean"
        }, {scrollbarSize: "number"}]), {
            pageList: (t.attr("pageList") ? eval(t.attr("pageList")) : undefined),
            loadMsg: (t.attr("loadMsg") != undefined ? t.attr("loadMsg") : undefined),
            rowStyler: (t.attr("rowStyler") ? eval(t.attr("rowStyler")) : undefined)
        });
    };
    $.fn.datagrid.parseData = function (_1dc) {
        var t = $(_1dc);
        var data = {total: 0, rows: []};
        var _1dd = t.datagrid("getColumnFields", true).concat(t.datagrid("getColumnFields", false));
        t.find("tbody tr").each(function () {
            data.total++;
            var row = {};
            $.extend(row, $.parser.parseOptions(this, ["iconCls", "state"]));
            for (var i = 0; i < _1dd.length; i++) {
                row[_1dd[i]] = $(this).find("td:eq(" + i + ")").html();
            }
            data.rows.push(row);
        });
        return data;
    };
    var _1de = {
        render: function (_1df, _1e0, _1e1) {
            var _1e2 = $.data(_1df, "datagrid");
            var opts = _1e2.options;
            var rows = _1e2.data.rows;
            var _1e3 = $(_1df).datagrid("getColumnFields", _1e1);
            if (_1e1) {
                if (!(opts.rownumbers || (opts.frozenColumns && opts.frozenColumns.length))) {
                    return;
                }
            }
            var _1e4 = ["<table class=\"datagrid-btable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
            for (var i = 0; i < rows.length; i++) {
                var cls = (i % 2 && opts.striped) ? "class=\"datagrid-row datagrid-row-alt\"" : "class=\"datagrid-row\"";
                var _1e5 = opts.rowStyler ? opts.rowStyler.call(_1df, i, rows[i]) : "";
                var _1e6 = _1e5 ? "style=\"" + _1e5 + "\"" : "";
                var _1e7 = _1e2.rowIdPrefix + "-" + (_1e1 ? 1 : 2) + "-" + i;
                _1e4.push("<tr id=\"" + _1e7 + "\" datagrid-row-index=\"" + i + "\" " + cls + " " + _1e6 + ">");
                _1e4.push(this.renderRow.call(this, _1df, _1e3, _1e1, i, rows[i]));
                _1e4.push("</tr>");
            }
            _1e4.push("</tbody></table>");
            $(_1e0).html(_1e4.join(""));
        }, renderFooter: function (_1e8, _1e9, _1ea) {
            var opts = $.data(_1e8, "datagrid").options;
            var rows = $.data(_1e8, "datagrid").footer || [];
            var _1eb = $(_1e8).datagrid("getColumnFields", _1ea);
            var _1ec = ["<table class=\"datagrid-ftable\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
            for (var i = 0; i < rows.length; i++) {
                _1ec.push("<tr class=\"datagrid-row\" datagrid-row-index=\"" + i + "\">");
                _1ec.push(this.renderRow.call(this, _1e8, _1eb, _1ea, i, rows[i]));
                _1ec.push("</tr>");
            }
            _1ec.push("</tbody></table>");
            $(_1e9).html(_1ec.join(""));
        }, renderRow: function (_1ed, _1ee, _1ef, _1f0, _1f1) {
            var opts = $.data(_1ed, "datagrid").options;
            var cc = [];
            if (_1ef && opts.rownumbers) {
                var _1f2 = _1f0 + 1;
                if (opts.pagination) {
                    _1f2 += (opts.pageNumber - 1) * opts.pageSize;
                }
                cc.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">" + _1f2 + "</div></td>");
            }
            for (var i = 0; i < _1ee.length; i++) {
                var _1f3 = _1ee[i];
                var col = $(_1ed).datagrid("getColumnOption", _1f3);
                if (col) {
                    var _1f4 = _1f1[_1f3];
                    var _1f5 = col.styler ? (col.styler(_1f4, _1f1, _1f0) || "") : "";
                    var _1f6 = col.hidden ? "style=\"display:none;" + _1f5 + "\"" : (_1f5 ? "style=\"" + _1f5 + "\"" : "");
                    cc.push("<td field=\"" + _1f3 + "\" " + _1f6 + ">");
                    if (col.checkbox) {
                        var _1f6 = "";
                    } else {
                        var _1f6 = _1f5;
                        if (col.align) {
                            _1f6 += ";text-align:" + col.align + ";";
                        }
                        if (!opts.nowrap) {
                            _1f6 += ";white-space:normal;height:auto;";
                        } else {
                            if (opts.autoRowHeight) {
                                _1f6 += ";height:auto;";
                            }
                        }
                    }
                    cc.push("<div style=\"" + _1f6 + "\" ");
                    if (col.checkbox) {
                        cc.push("class=\"datagrid-cell-check ");
                    } else {
                        cc.push("class=\"datagrid-cell " + col.cellClass);
                    }
                    cc.push("\">");
                    if (col.checkbox) {
                        cc.push("<input type=\"checkbox\" name=\"" + _1f3 + "\" value=\"" + (_1f4 != undefined ? _1f4 : "") + "\"/>");
                    } else {
                        if (col.formatter) {
                            cc.push(col.formatter(_1f4, _1f1, _1f0));
                        } else {
                            cc.push(_1f4);
                        }
                    }
                    cc.push("</div>");
                    cc.push("</td>");
                }
            }
            return cc.join("");
        }, refreshRow: function (_1f7, _1f8) {
            this.updateRow.call(this, _1f7, _1f8, {});
        }, updateRow: function (_1f9, _1fa, row) {
            var opts = $.data(_1f9, "datagrid").options;
            var rows = $(_1f9).datagrid("getRows");
            $.extend(rows[_1fa], row);
            var _1fb = opts.rowStyler ? opts.rowStyler.call(_1f9, _1fa, rows[_1fa]) : "";

            function _1fc(_1fd) {
                var _1fe = $(_1f9).datagrid("getColumnFields", _1fd);
                var tr = opts.finder.getTr(_1f9, _1fa, "body", (_1fd ? 1 : 2));
                var _1ff = tr.find("div.datagrid-cell-check input[type=checkbox]").is(":checked");
                tr.html(this.renderRow.call(this, _1f9, _1fe, _1fd, _1fa, rows[_1fa]));
                tr.attr("style", _1fb || "");
                if (_1ff) {
                    tr.find("div.datagrid-cell-check input[type=checkbox]")._propAttr("checked", true);
                }
            };
            _1fc.call(this, true);
            _1fc.call(this, false);
            $(_1f9).datagrid("fixRowHeight", _1fa);
        }, insertRow: function (_200, _201, row) {
            var _202 = $.data(_200, "datagrid");
            var opts = _202.options;
            var dc = _202.dc;
            var data = _202.data;
            if (_201 == undefined || _201 == null) {
                _201 = data.rows.length;
            }
            if (_201 > data.rows.length) {
                _201 = data.rows.length;
            }
            function _203(_204) {
                var _205 = _204 ? 1 : 2;
                for (var i = data.rows.length - 1; i >= _201; i--) {
                    var tr = opts.finder.getTr(_200, i, "body", _205);
                    tr.attr("datagrid-row-index", i + 1);
                    tr.attr("id", _202.rowIdPrefix + "-" + _205 + "-" + (i + 1));
                    if (_204 && opts.rownumbers) {
                        var _206 = i + 2;
                        if (opts.pagination) {
                            _206 += (opts.pageNumber - 1) * opts.pageSize;
                        }
                        tr.find("div.datagrid-cell-rownumber").html(_206);
                    }
                }
            };
            function _207(_208) {
                var _209 = _208 ? 1 : 2;
                var _20a = $(_200).datagrid("getColumnFields", _208);
                var _20b = _202.rowIdPrefix + "-" + _209 + "-" + _201;
                var tr = "<tr id=\"" + _20b + "\" class=\"datagrid-row\" datagrid-row-index=\"" + _201 + "\"></tr>";
                if (_201 >= data.rows.length) {
                    if (data.rows.length) {
                        opts.finder.getTr(_200, "", "last", _209).after(tr);
                    } else {
                        var cc = _208 ? dc.body1 : dc.body2;
                        cc.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>" + tr + "</tbody></table>");
                    }
                } else {
                    opts.finder.getTr(_200, _201 + 1, "body", _209).before(tr);
                }
            };
            _203.call(this, true);
            _203.call(this, false);
            _207.call(this, true);
            _207.call(this, false);
            data.total += 1;
            data.rows.splice(_201, 0, row);
            this.refreshRow.call(this, _200, _201);
        }, deleteRow: function (_20c, _20d) {
            var _20e = $.data(_20c, "datagrid");
            var opts = _20e.options;
            var data = _20e.data;

            function _20f(_210) {
                var _211 = _210 ? 1 : 2;
                for (var i = _20d + 1; i < data.rows.length; i++) {
                    var tr = opts.finder.getTr(_20c, i, "body", _211);
                    tr.attr("datagrid-row-index", i - 1);
                    tr.attr("id", _20e.rowIdPrefix + "-" + _211 + "-" + (i - 1));
                    if (_210 && opts.rownumbers) {
                        var _212 = i;
                        if (opts.pagination) {
                            _212 += (opts.pageNumber - 1) * opts.pageSize;
                        }
                        tr.find("div.datagrid-cell-rownumber").html(_212);
                    }
                }
            };
            opts.finder.getTr(_20c, _20d).remove();
            _20f.call(this, true);
            _20f.call(this, false);
            data.total -= 1;
            data.rows.splice(_20d, 1);
        }, onBeforeRender: function (_213, rows) {
        }, onAfterRender: function (_214) {
            var opts = $.data(_214, "datagrid").options;
            if (opts.showFooter) {
                var _215 = $(_214).datagrid("getPanel").find("div.datagrid-footer");
                _215.find("div.datagrid-cell-rownumber,div.datagrid-cell-check").css("visibility", "hidden");
            }
        }
    };
    $.fn.datagrid.defaults = $.extend({}, $.fn.panel.defaults, {
        frozenColumns: undefined,
        columns: undefined,
        fitColumns: false,
        resizeHandle: "right",
        autoRowHeight: true,
        toolbar: null,
        striped: false,
        method: "post",
        nowrap: true,
        idField: null,
        url: null,
        data: null,
        loadMsg: "Processing, please wait ...",
        rownumbers: false,
        singleSelect: false,
        selectOnCheck: true,
        checkOnSelect: true,
        pagination: false,
        pagePosition: "bottom",
        pageNumber: 1,
        pageSize: 10,
        pageList: [10, 20, 30, 40, 50],
        queryParams: {},
        sortName: null,
        sortOrder: "asc",
        remoteSort: true,
        showHeader: true,
        showFooter: false,
        scrollbarSize: 18,
        rowStyler: function (_216, _217) {
        },
        loader: function (_218, _219, _21a) {
            var opts = $(this).datagrid("options");
            if (!opts.url) {
                return false;
            }
            $.ajax({
                type: opts.method, url: opts.url, data: _218, dataType: "json", success: function (data) {
                    _219(data);
                }, error: function () {
                    _21a.apply(this, arguments);
                }
            });
        },
        loadFilter: function (data) {
            if (typeof data.length == "number" && typeof data.splice == "function") {
                return {total: data.length, rows: data};
            } else {
                return data;
            }
        },
        editors: _16e,
        finder: {
            getTr: function (_21b, _21c, type, _21d) {
                type = type || "body";
                _21d = _21d || 0;
                var _21e = $.data(_21b, "datagrid");
                var dc = _21e.dc;
                var opts = _21e.options;
                if (_21d == 0) {
                    var tr1 = opts.finder.getTr(_21b, _21c, type, 1);
                    var tr2 = opts.finder.getTr(_21b, _21c, type, 2);
                    return tr1.add(tr2);
                } else {
                    if (type == "body") {
                        var tr = $("#" + _21e.rowIdPrefix + "-" + _21d + "-" + _21c);
                        if (!tr.length) {
                            tr = (_21d == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index=" + _21c + "]");
                        }
                        return tr;
                    } else {
                        if (type == "footer") {
                            return (_21d == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index=" + _21c + "]");
                        } else {
                            if (type == "selected") {
                                return (_21d == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-selected");
                            } else {
                                if (type == "highlight") {
                                    return (_21d == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row-over");
                                } else {
                                    if (type == "checked") {
                                        return (_21d == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr.datagrid-row:has(div.datagrid-cell-check input:checked)");
                                    } else {
                                        if (type == "last") {
                                            return (_21d == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]:last");
                                        } else {
                                            if (type == "allbody") {
                                                return (_21d == 1 ? dc.body1 : dc.body2).find(">table>tbody>tr[datagrid-row-index]");
                                            } else {
                                                if (type == "allfooter") {
                                                    return (_21d == 1 ? dc.footer1 : dc.footer2).find(">table>tbody>tr[datagrid-row-index]");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }, getRow: function (_21f, p) {
                var _220 = (typeof p == "object") ? p.attr("datagrid-row-index") : p;
                return $.data(_21f, "datagrid").data.rows[parseInt(_220)];
            }
        },
        view: _1de,
        onBeforeLoad: function (_221) {
        },
        onLoadSuccess: function () {
        },
        onLoadError: function () {
        },
        onClickRow: function (_222, _223) {
        },
        onDblClickRow: function (_224, _225) {
        },
        onClickCell: function (_226, _227, _228) {
        },
        onDblClickCell: function (_229, _22a, _22b) {
        },
        onSortColumn: function (sort, _22c) {
        },
        onResizeColumn: function (_22d, _22e) {
        },
        onSelect: function (_22f, _230) {
        },
        onUnselect: function (_231, _232) {
        },
        onSelectAll: function (rows) {
        },
        onUnselectAll: function (rows) {
        },
        onCheck: function (_233, _234) {
        },
        onUncheck: function (_235, _236) {
        },
        onCheckAll: function (rows) {
        },
        onUncheckAll: function (rows) {
        },
        onBeforeEdit: function (_237, _238) {
        },
        onAfterEdit: function (_239, _23a, _23b) {
        },
        onCancelEdit: function (_23c, _23d) {
        },
        onHeaderContextMenu: function (e, _23e) {
        },
        onRowContextMenu: function (e, _23f, _240) {
        }
    });
})(jQuery);

